From e8653d0da6bb1402478853a4c1f87e668fadc644 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 11 Jul 2018 23:23:08 +0200 Subject: [PATCH] babl: make babl_model_with_space able to take format/model for space --- babl/babl-model.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/babl/babl-model.c b/babl/babl-model.c index 2156059..d3471ed 100644 --- a/babl/babl-model.c +++ b/babl/babl-model.c @@ -374,6 +374,20 @@ babl_remodel_with_space (const Babl *model, const Babl *space) int i; assert (BABL_IS_BABL (model)); + if (!space) space = babl_space ("sRGB"); + if (space->class_type == BABL_FORMAT) + { + space = space->format.space; + } + else if (space->class_type == BABL_MODEL) + { + space = space->model.space; + } + else if (space->class_type != BABL_SPACE) + { + return NULL; + } + if (model->model.space == space) return (void*)model; -- 2.30.2